/*
 * @Author: 火红色祥云 809880192@qq.com
 * @Date: 2023-03-22 20:45:47
 * @LastEditors: 火红色祥云 809880192@qq.com
 * @LastEditTime: 2023-03-22 21:36:41
 * @FilePath: /imx6ull-app/22_RFID_RC522/22_rfid_rc522.c
 * @Description: 硬件SPIRFID_RC522驱动
 */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ide.h>

#include "rfid_rc522.h"

#include "linux/spi/spi.h"

/*********************************************SPI底层加载********************************************************/

static int spi_write_reg(struct spi_device *spi,u8 reg,u8 *buf,u8 len)
{
    
    return 0;
}

static int spi_read_reg(struct spi_device *spi,u8 reg,u8 *buf,u8 len)
{

}

/*********************************************SPI底层加载********************************************************/

/*********************************************SPI中间层加载********************************************************/

static int rc522_write_reg(struct spi_device *spi,u8 reg,u8 value)
{

}

static int rc522_read_reg(struct spi_device *spi,u8 reg)
{
    
}
/*********************************************SPI中间层加载********************************************************/

/*********************************************RC522硬件加载********************************************************/



/*********************************************RC522硬件加载********************************************************/

/*********************************************设备驱动加载********************************************************/
int rc522_probe(struct spi_device *spi)
{
    printk("rc522 probe match success\r\n");
    return 0;
}

int rc522_remove(struct spi_device *spi)
{

    return 0;
}

static const struct spi_device_id rc522_id_table[] = {
    {"lux,rfid_rc522",0},
    {}
};
static const struct of_device_id rc522_of_match_table[] = {
    {.compatible= "lux,rfid_rc522"},
    {}
};
struct spi_driver rc522_dev = {
    .probe = rc522_probe,
    .remove = rc522_remove,
    .id_table = rc522_id_table,
    .driver = {
        .owner = THIS_MODULE,
        .of_match_table = rc522_of_match_table,
        .name = "RC522",
        .mod_name = "RC522",
    },
};

static __init int rfid_rc522_init(void)
{
    spi_register_driver(&rc522_dev);
    return 0;
}

static __exit void rfid_rc522_exit(void)
{
    spi_unregister_driver(&rc522_dev);
}

module_init(rfid_rc522_init);
module_exit(rfid_rc522_exit);


MODULE_AUTHOR("Lux");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("RFID_RC522 驱动");

/*********************************************设备驱动加载********************************************************/